Boook club R-Ladies Bergen, R-Ladies Den Bosch, R-Ladies Amsterdam
By clicking on a specific file we can look at the Code, Preview (rendered code) and Blame
Blame is analogous to git blame
If you want to propose a change to someone else’s repo
When in doubt, use ‘fork and clone’ over ‘just clone’
Method A: Browser, command line and RStudio
Method B: Using usethis::create_from_github()
Method C: Github Desktop
Click fork on the Github page of the original repo (OWNER/REPO) - creates a copy in your account (YOU/REPO)
Clone the newly create YOU/REPO onto your machine
Highly recommended: Configure the upstream remote in one of these ways
git remote add upstream https://github.com/OWNER/REPO.git
usethis::use_git_remote(name = "upstream", url = "https://github.com/OWNER/REPO.git")
Clicking on new branch and pasting the link of the original rep
Use git fetch upstream to pull changes from the upstream
Use git branch -u upstream/main to set the original repo as the tracking branch for your local branch
Pushes to and pulls from the original repo automatically
create_from_github()usethis::create_from_github("https://github.com/OWNER/REPO")
Download Github Desktop and connect your Github account
Fork the repository in Github, then clone
create_from_github()git remote -vgit remote show originDo not make commits to the main of a repo you have forked - this will create discrepancies
Instead: Create a new branch and use a pull request
It’s recommended to always work in a new branch and not in the main of your forked repo
In this case no problem, we can sync the fork
However, we may run into issues if the original main is updated
List your remotes:
git remote -v in the command line
usethis::git_remotes() in the console
Use git branch -vv to view the upstream tracking branch
git pull upstream main --ff-only and then git push origin mainorigin repoLet’s say you have two mains:
The OWNER/REPO: A - B - C - D - E - F
YOUR/REPO: A - B - C - X - Y - Z
Create a new branch and switch to it, e.g., git checkout -b session-06
Then switch back to your main and do a hard reset, e.g., git checkout main and then reset the main to the previous compatible commit (git reset --hard C)
Fork and clone the original repository
Branch and make your change
Submit a pull request
Review pull request, merge and finish
One of Github’s advantages is that you can browse repositories in the browser
Derived products may be useful to your audience - so you may want to consider keeping file formats such as .md which can be viewed on Github
You can tweak a few options in the R Markdown settings to make it more Github-friendly
Keep the .md file
README.md files as a sort of landing page
Use t as a file finder
Github automatically renders .tsv and .csv files
Github pages, e.g., to host a website for an R package (you can do this via pkgdown)
[R-Ladies Book Club]